<!--
 * @Author: your name
 * @Date: 2021-12-27 15:09:02
 * @LastEditTime: 2022-12-12 16:34:15
 * @LastEditors: sunli
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: /etrip-ui/src/pages/dialog/demo.vue
-->
<script setup>
import {Dialog} from '../../../packages/lib/index-es.js'
const toast = async () => {
  await Dialog.alert({
    message: 'async await',
    className: 'xxx'
  })
  console.log('async await')

  Dialog.alert('then')
    .then(() => {
      console.log('then')
    })
    
}

const confirm = async () => {
  Dialog.confirm('then')
    .then(() => {
      console.log('confirm')
    })
    .catch(() => {
      console.log('close')
    })
}

const prompt = () => {
  Dialog.prompt({placeholder: '请不要再输入'})
    .then(() => {
      console.log('confirm')
    })
    .catch(() => {
      console.log('close')
    })
}
const prompt_1 = () => {
  Dialog.prompt({type: 'textarea'})
    .then(() => {
      console.log('confirm')
    })
    .catch(() => {
      console.log('close')
    })

}
</script>

<template>
  <div>
    <button @click="toast">alert点击</button>
    <button @click="confirm">confirm点击</button>
    <button @click="prompt">prompt点击</button>
    <button @click="prompt_1">prompt多行文本</button>
  </div>
</template>